package com.glela.common.constant;

import org.apache.commons.lang3.StringUtils;

/**
 * 系统配置
 * 
 * @author liujie
 */
public enum GenderEnum
{
	/** 男 */
 	male("男",1),
 	/** 女 */
	fmale("女",0);
 	public static final int MALE = 1;
	public static final int FMALE = 0;
   	//操作类型
	private String genderDesc;
	private int gender;
		
	GenderEnum(String genderDesc,int gender){
		this.gender = gender;
		this.genderDesc = genderDesc;
	}
	public String getGenderDesc() {
		return genderDesc;
	}

	public void setGenderDesc(String genderDesc) {
		this.genderDesc = genderDesc;
	}

	public int getGender() {
		return gender;
	}

	public void setGender(int gender) {
		this.gender = gender;
	}
	
	/**根据性别 男， 女 获取 1， 0 
	 * @param genderDesc
	 * @return
	 */
	public static int getGenderByDesc(String genderDesc){
		if(StringUtils.isEmpty(genderDesc)){
			return -1;
		}
		for(GenderEnum elem:values()){
			if(elem.getGenderDesc().equals(genderDesc)){
				return elem.getGender();
			}
		}
		return -1;
	}
	
}
